/**
 * Copyright (c) 2015-2030 by Beijing Yanlight Co., Ltd.
 * All rights reserved.
 */
package com.yanlight.exception;

/**
 * 
 * 
 * @author haolw
 * @time 2017/06/27
 */
public class TradeException extends RuntimeException {
	private static final long serialVersionUID = 1L;
	private ErrorType errorType;

	public TradeException() {

	}

	public TradeException(String message) {
		super(message);
	}

	public TradeException(Throwable cause) {
		super(cause);
	}

	public TradeException(ErrorType errorType) {
		this.errorType = errorType;
	}

	public TradeException(ErrorType errorType, String message) {
		super(message);
		this.errorType = errorType;
	}

	public static TradeException error(ErrorType error) {
		return new TradeException(error);
	}

	public static TradeException error(ErrorType error, String message) {
		return new TradeException(error, message);
	}

	public static TradeException systemError() {
		return new TradeException(ErrorType.SYSTEM_ERROR);
	}

	public ErrorType getErrorType() {
		return errorType;
	}

	public void setErrorType(ErrorType errorType) {
		this.errorType = errorType;
	}
}
